package com.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.domain.dto.TeamQuery;
import com.domain.dto.UserShowInfo;
import com.domain.entity.Team;
import com.domain.entity.User;
import com.domain.request.TeamJoinRequest;
import com.domain.request.TeamQuitRequest;
import com.domain.request.TeamUpdateRequest;
import com.domain.vo.TeamUserVO;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/**
 * 队伍服务
 *
 */
public interface TeamService extends IService<Team> {

    /**
     * 创建队伍
     *
     * @param team
     * @param loginUser
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    long createTeam(Team team, User loginUser);

    /**
     * 搜索队伍
     *
     * @param teamQuery
     * @param isAdmin
     * @return
     */
    List<TeamUserVO> listTeams(TeamQuery teamQuery, boolean isAdmin);

    /**
     * 更新队伍
     *
     * @param teamUpdateRequest
     * @param loginUser
     * @return
     */
    boolean updateTeam(TeamUpdateRequest teamUpdateRequest, User loginUser);

    /**
     * 加入队伍
     *
     * @param teamJoinRequest
     * @return
     */
    boolean joinTeam(TeamJoinRequest teamJoinRequest, User loginUser);

    /**
     * 退出队伍
     *
     * @param teamQuitRequest
     * @param loginUser
     * @return
     */
    boolean quitTeam(TeamQuitRequest teamQuitRequest, User loginUser);


    /**
     * 删除（解散）队伍
     *
     * @param id
     * @param loginUser
     * @return
     */
    boolean deleteTeam(long id, User loginUser);

    /**
     * 获取队伍所有成员列表
     * @param teamId
     * @return
     */
    List<UserShowInfo> getTeamMember(Long teamId);
}
